package com.example.demo.controller.emptCon;

import com.example.demo.annotate.Log;
import com.example.demo.pojo.Result;
import com.example.demo.pojo.emp.Dept;
import com.example.demo.pojo.emp.Empt;
import com.example.demo.service.impl.DeptServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@RequestMapping("/department")
public class DeptController {

    @Autowired
    private DeptServiceImpl deptService;


    @RequestMapping(value = "/depts")
    public Result list() {
//        123455
        //查询部门所有信息lll222333
       List<Dept> deptList = deptService.list();
        return Result.success(deptList);
    }

    @PostMapping("/addDept")
    @Log
    public Result addDept(Dept dept) {
        Boolean aBoolean = deptService.addDept(dept);
        if(aBoolean) return Result.success();
        else return Result.error("添加失败",null);
    }



}
